﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Slja.Utility;

namespace FrameWork.web.Web
{
    public partial class Message : System.Web.UI.Page
    {
        //msg={0}&type={1}&backurl
        string Msg
        {
            get { return Request.QueryString["msg"]; }
        }
        MsgState Type
        {
            get { return (MsgState)Enum.Parse(typeof(MsgState), Request.QueryString["type"]); }
        }
        string Backurl
        {
            get { return Request.QueryString["backurl"]; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Type == MsgState.error)
                {
                    lbMsg.ForeColor = System.Drawing.Color.Red;
                }
                else if (Type == MsgState.successful)
                {
                    lbMsg.ForeColor = System.Drawing.Color.Green;
                }
                else if (Type == MsgState.warning)
                {
                    lbMsg.ForeColor = System.Drawing.Color.Black;
                }
                lbMsg.Text = Msg;              

            }
            btnBack.Click += new EventHandler(btnBack_Click);

        }

        void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect(Backurl);
        }
    }
}